<?php

namespace App\Admin\Http\Requests;

class MenuRequest extends Request
{
    /**
     * 用户请求认证
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 设置请求验证规则
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'name' => 'required|max:20',
            'action' => 'max:200',
            'description' => 'max:100',
            'icon' => 'required|max:20',
            'level' => 'required|integer',
            'pid'=>'integer'
        ];

        return $rules;
    }

    /**
     * 翻译验证属性
     *
     * @return array
     */
    public function attributes()
    {
        return [
            'name' => '名称',
            'action' => '控制器',
            'description' => '描述',
            'icon' => '图标',
            'level' => '等级',
            'pid'=>'父级编号'
        ];
    }
}
